

*** Set Fixed Effects and Clustering
global fe "courtq"
global clusvar "partyr"

capture frame drop futurecase
frame create futurecase str55 outcome str32 specification str32 estsamp beta se N 

foreach g in all female black {
foreach spec in ols rf iv  meansd  {
	foreach out in  futurecase1 futurecase2 {

	global controls "" 
	
	if "`spec'"=="ols" {
		reghdfe `out' evictionorder if samp==1 & `g'==1, absorb($fe ) cluster($clustvar)
		frame post futurecase ("`out'") ("`spec'") ("`g'") (_b[evictionorder]) (_se[evictionorder]) (e(N))
	}
	
	if "`spec'"=="iv" {
		ivreghdfe `out'  (evictionorder =stringency) if samp==1 & `g'==1, , absorb($fe ) cluster($clustvar)
		frame post futurecase ("`out'") ("`spec'") ("`g'") (_b[evictionorder]) (_se[evictionorder]) (e(N))
	}

	if "`spec'"=="rf" {
		ivreghdfe `out'  stringency if samp==1 & `g'==1, , absorb($fe ) cluster($clustvar)
		frame post futurecase ("`out'") ("`spec'") ("`g'") (_b[stringency]) (_se[stringency]) (e(N))
	}

	if "`spec'"=="meansd" {
		sum `out' if  evictionorder==0 & `g'==1
		frame post futurecase ("`out'") ("`spec'") ("`g'") (`=r(mean)') (`=r(sd)') (`=r(N)')
	}
	}
}
}
frame change futurecase

replace specification=upper(specification)
replace estsamp=upper(estsamp)

frame futurecase: saveold ${Inputs}/NY_futurecase_ivols.dta, replace
